<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class Administrator extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
		'username'  => ['require', 'regex' => '/^[a-zA-Z][a-zA-Z0-9_]{6,15}$/'],
	    'password'  => ['require'],
	    'email'     => ['require', 'email'],
	    'mobile'    => ['require', 'mobile']
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
		'username.require' => '用户名必须',
		'username.between' => '用户名长度6-15位',
		'username.regex'   => '用户名格式不正确,仅支持字母、数字、下划线',
		'password.require' => '密码必须',
		'email.require'    => '邮箱必须',
		'email.email'      => '邮箱格式不正确',
		'mobile.require'   => '手机号必须',
		'mobile.mobile'    => '手机号格式不正确'
    ];
}
